﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DefectDBTypes;

namespace Graph
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow: Window, INotifyPropertyChanged
	{
		private MonitoredClients		mw_clients;

		public event PropertyChangedEventHandler PropertyChanged;

		public MonitoredClients Clients
		{
			get
			{
				return mw_clients;
			}
			set
			{
				mw_clients = value;
				FirePropertyChangedEvent("Clients");
			}
		}

		public MainWindow ()
		{
			InitializeComponent();
			DataContext = this;
		}

		private void OnLoaded (object sender, RoutedEventArgs e)
		{
			Client  c;
			MonitoredClients mc = new MonitoredClients();
			c = new Client();
			c.Last_Name = "CL1";
			c.First_Name = "CF1";
			mc.Add(c);

			c = new Client();
			c.Last_Name = "CL2";
			c.First_Name = "CF2";
			mc.Add(c);


			Clients  = mc;

		}

		private void FirePropertyChangedEvent (string propertyName)
		{
			if (PropertyChanged != null)
				PropertyChanged(this,new PropertyChangedEventArgs(propertyName));
		}

		private void OnClick (object sender, RoutedEventArgs e)
		{
            g.DataContext = null;
			Client c = new Client();
			c.First_Name = "na";
			c.Last_Name = (Clients.Count + 1).ToString();
			Clients.Add(c);
		}
		

		// go get client collection from server
		// go get the trouble reprot collection for each client
	}
}
